<?php //pack11class

class TopPanel extends Module {

    public function setup() {
        if(array_key_exists("dekaro_master", $_COOKIE)) {
            $cookie=$_COOKIE["dekaro_master"];
            MySQLGet::process("Select `id` from ".MySQL::TABLE_USERS." where `cookie`='".$cookie."' limit 1");
            if(MySQLGet::$cc==1) {
                if(is_bool($this->param)) {
                    if($this->param) {
                        $prw=(strlen($_SERVER['QUERY_STRING'])>0)? "?".$_SERVER['QUERY_STRING']."&preview":"?preview";
                        //<a href="'.$prw.'" target="_blank">preview</a>&nbsp;|&nbsp;
                        $this->addHTML('<a href="?exit">exit</a>');
                    } else {
                        $this->addHTML('<a href="?admin">admin</a>');
                    }
                } else {
                    $this->setClass("TopPanelText");
                    $this->addHTML(LabelManager::getLabel("under_construction"));
                }
                $this->addHTML("&nbsp;|&nbsp;");
            }
        }
        $this->addHTML(Template::html(new LanguagesSwitcher()));
    }

}
?>
